﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DataMappers;
using ExaminationTT.Model;

namespace ConcreteMappersAndObjects.DomainObjects
{
    public class Semester : DomainObject<int, Semester> , ISemester
    {
        private string _description;
        private int _number;

        private readonly IEnumerable<CUSemester> _cuSemester;

        public Semester() : base()
        {
        }

        public Semester(int id, string description, int number, IEnumerable<CUSemester> cUnits) : base(id)
        {
            _description = description;
            _cuSemester = cUnits;
            _number = number;
        }

        protected override Semester Self()
        {
            return this;
        }


        public string Description
        {
            get { return _description; }
            set { _description = value; MarkDirty(); }
        }

        public int Number
        {
            get { return _number; }
            set { _number = value; MarkDirty(); }
        }

        public IEnumerable<CUSemester> CUnits
        {
            get { return _cuSemester; }
           // set { _cuSemester = value; MarkDirty(); }
        }


        #region ISemester Members

        string ISemester.Description
        {
            get { return _description; }
        }

        IEnumerable<ICUSemester> ISemester.CUnits
        {
            get { return _cuSemester.ToArray(); }
        }

        #endregion
    }
}
